#ifndef						_UTILITY_H_
#define						_UTILITY_H_

struct stTimeset
{
	unsigned int tm_sec;     //!< seconds after the minute - [0,59]
	unsigned int tm_min;     //!< minutes after the hour - [0,59]
	unsigned int tm_hour;    //!< hours since midnight - [0,23]
	unsigned int tm_mday;    //!< day of the month - [1,31]
	unsigned int tm_mon;     //!< months since January - [0,11]
	unsigned int tm_year;    //!< years since 1900
	unsigned int tm_wday;    //!< days since Sunday - [0,6]
	unsigned int tm_yday;    //!< days since January 1 - [0,365]

	stTimeset()
	{
		this->tm_sec	= 0;
		this->tm_min	= 0;
		this->tm_hour	= 0;
		this->tm_mday	= 0;
		this->tm_mon	= 0;
		this->tm_year	= 0;
		this->tm_wday	= 0;
		this->tm_year	= 0;
	}

	stTimeset(unsigned int sec, unsigned int min, unsigned int hour, 
			  unsigned int mday, unsigned int mon, unsigned int year, 
			  unsigned int wday, unsigned int yday)
	{
		this->tm_sec	= sec;
		this->tm_min	= min;
		this->tm_hour	= hour;
		this->tm_mday	= mday;
		this->tm_mon	= mon;
		this->tm_year	= year;
		this->tm_wday	= wday;
		this->tm_year	= yday;
	}

	void operator=(const stTimeset& time)
	{
		this->tm_sec	= time.tm_sec;
		this->tm_min	= time.tm_min;
		this->tm_hour	= time.tm_hour;
		this->tm_mday	= time.tm_mday;
		this->tm_mon	= time.tm_mon;
		this->tm_year	= time.tm_year;
		this->tm_wday	= time.tm_wday;
		this->tm_yday	= time.tm_yday;
	}
};

class CUtility
{
public:
	enum
	{
		ONEMIN_SEC		= 60,
		ONEHOUR_SEC		= 3600,
		ONEHOUR_MIN		= 60,
		ONEDAY_HOUR		= 24,
		ONEYEAR_HOUR	= 8544,
		ONEYEAR_DAY		= 365,
		BASIC_YEAR		= 1900,
		DAYS_WEEK		= 7,
	};

	enum TIMEZONE
	{
		SEOUL		= 9,
		BEIJING		= 7,
		HAWAII		= -10,
		USA			= -8,
		CANADA		= -8,
	};

	CUtility() {}
	~CUtility() {}

	static unsigned long	EpochTime(void);
	static unsigned short	MilliSec(void);
	static void				BinaryToDate(unsigned long nBinary, stTimeset& dateTime, TIMEZONE timeZone);
	static unsigned int		Convert2Hour(stTimeset dateTime);

private:
	static unsigned long	m_ConvertDays2Mon(unsigned int nDays);
	
protected:

};

#endif						//_UTILITY_H_

